{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "544fa182",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pathlib\n",
    "import pickle\n",
    "\n",
    "import numpy as np\n",
    "import scipy.sparse\n",
    "import scipy.io\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "bf25a1eb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "39"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "num_drug = 1482\n",
    "num_dis = 793\n",
    "# 5%为强负样本\n",
    "hardnegatives=int(num_dis*0.05)\n",
    "hardnegatives"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f72ffd41",
   "metadata": {},
   "outputs": [],
   "source": [
    "us=np.load(\"USAM.npy\")\n",
    "dd=np.load(\"DDAM.npy\")\n",
    "score=np.load(\"SCORE_DD.npy\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f709da73",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>1472</th>\n",
       "      <th>1473</th>\n",
       "      <th>1474</th>\n",
       "      <th>1475</th>\n",
       "      <th>1476</th>\n",
       "      <th>1477</th>\n",
       "      <th>1478</th>\n",
       "      <th>1479</th>\n",
       "      <th>1480</th>\n",
       "      <th>1481</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0013</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0020</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0020</td>\n",
       "      <td>0.0017</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0957</td>\n",
       "      <td>0.0365</td>\n",
       "      <td>0.0365</td>\n",
       "      <td>0.0779</td>\n",
       "      <td>0.0365</td>\n",
       "      <td>0.0215</td>\n",
       "      <td>0.0611</td>\n",
       "      <td>0.0022</td>\n",
       "      <td>0.0661</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.0068</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0110</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0099</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0204</td>\n",
       "      <td>0.0099</td>\n",
       "      <td>0.0061</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1105</td>\n",
       "      <td>0.0834</td>\n",
       "      <td>0.0834</td>\n",
       "      <td>0.0855</td>\n",
       "      <td>0.0834</td>\n",
       "      <td>0.0275</td>\n",
       "      <td>1.0000</td>\n",
       "      <td>0.0119</td>\n",
       "      <td>0.0854</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.0068</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0110</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0099</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0204</td>\n",
       "      <td>0.0099</td>\n",
       "      <td>0.0061</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1105</td>\n",
       "      <td>0.0834</td>\n",
       "      <td>0.0834</td>\n",
       "      <td>0.0855</td>\n",
       "      <td>0.0834</td>\n",
       "      <td>0.0275</td>\n",
       "      <td>1.0000</td>\n",
       "      <td>0.0119</td>\n",
       "      <td>0.0854</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.0018</td>\n",
       "      <td>0.0008</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0395</td>\n",
       "      <td>0.0095</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0263</td>\n",
       "      <td>0.0095</td>\n",
       "      <td>0.0026</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0529</td>\n",
       "      <td>0.0384</td>\n",
       "      <td>0.0384</td>\n",
       "      <td>0.0424</td>\n",
       "      <td>0.0384</td>\n",
       "      <td>0.0282</td>\n",
       "      <td>0.0369</td>\n",
       "      <td>0.0120</td>\n",
       "      <td>0.0554</td>\n",
       "      <td>0.002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0065</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0068</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0068</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1402</td>\n",
       "      <td>0.0763</td>\n",
       "      <td>0.0763</td>\n",
       "      <td>0.1018</td>\n",
       "      <td>0.0763</td>\n",
       "      <td>0.0292</td>\n",
       "      <td>1.0000</td>\n",
       "      <td>0.0077</td>\n",
       "      <td>0.1003</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>788</th>\n",
       "      <td>0.0011</td>\n",
       "      <td>0.0005</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0132</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0167</td>\n",
       "      <td>0.0132</td>\n",
       "      <td>0.0016</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0978</td>\n",
       "      <td>0.0758</td>\n",
       "      <td>0.0758</td>\n",
       "      <td>0.0851</td>\n",
       "      <td>0.0758</td>\n",
       "      <td>0.0373</td>\n",
       "      <td>0.0967</td>\n",
       "      <td>0.0155</td>\n",
       "      <td>0.0852</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>789</th>\n",
       "      <td>0.0014</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0016</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0122</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0122</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1089</td>\n",
       "      <td>0.0316</td>\n",
       "      <td>0.0316</td>\n",
       "      <td>0.0956</td>\n",
       "      <td>0.0316</td>\n",
       "      <td>0.0491</td>\n",
       "      <td>0.0762</td>\n",
       "      <td>0.0157</td>\n",
       "      <td>0.1003</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>790</th>\n",
       "      <td>0.0011</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0013</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0046</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0278</td>\n",
       "      <td>0.0046</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1288</td>\n",
       "      <td>0.0835</td>\n",
       "      <td>0.0835</td>\n",
       "      <td>0.1011</td>\n",
       "      <td>0.0835</td>\n",
       "      <td>0.0175</td>\n",
       "      <td>0.0885</td>\n",
       "      <td>0.0051</td>\n",
       "      <td>0.0871</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>791</th>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0013</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0021</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0021</td>\n",
       "      <td>0.0017</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0967</td>\n",
       "      <td>0.0348</td>\n",
       "      <td>0.0348</td>\n",
       "      <td>0.0789</td>\n",
       "      <td>0.0348</td>\n",
       "      <td>0.0224</td>\n",
       "      <td>0.0584</td>\n",
       "      <td>0.0023</td>\n",
       "      <td>0.0636</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>792</th>\n",
       "      <td>0.0009</td>\n",
       "      <td>0.0004</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0000</td>\n",
       "      <td>0.0192</td>\n",
       "      <td>0.0159</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0128</td>\n",
       "      <td>0.0159</td>\n",
       "      <td>0.0005</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0996</td>\n",
       "      <td>0.0771</td>\n",
       "      <td>0.0771</td>\n",
       "      <td>0.0842</td>\n",
       "      <td>0.0771</td>\n",
       "      <td>0.0410</td>\n",
       "      <td>0.0948</td>\n",
       "      <td>0.0197</td>\n",
       "      <td>0.0930</td>\n",
       "      <td>0.001</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>793 rows × 1482 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       0       1     2       3       4       5     6       7       8     \\\n",
       "0    0.0000  0.0013   0.0  0.0000  0.0000  0.0020   0.0  0.0000  0.0020   \n",
       "1    0.0068  0.0000   0.0  0.0110  0.0000  0.0099   1.0  0.0204  0.0099   \n",
       "2    0.0068  0.0000   0.0  0.0110  0.0000  0.0099   1.0  0.0204  0.0099   \n",
       "3    0.0018  0.0008   0.0  0.0000  0.0395  0.0095   0.0  0.0263  0.0095   \n",
       "4    0.0000  0.0000   0.0  0.0065  0.0000  0.0068   0.0  0.0000  0.0068   \n",
       "..      ...     ...   ...     ...     ...     ...   ...     ...     ...   \n",
       "788  0.0011  0.0005   0.0  0.0000  0.0000  0.0132   0.0  0.0167  0.0132   \n",
       "789  0.0014  0.0000   0.0  0.0016  0.0000  0.0122   0.0  0.0000  0.0122   \n",
       "790  0.0011  0.0000   0.0  0.0013  0.0000  0.0046   0.0  0.0278  0.0046   \n",
       "791  0.0000  0.0013   0.0  0.0000  0.0000  0.0021   0.0  0.0000  0.0021   \n",
       "792  0.0009  0.0004   0.0  0.0000  0.0192  0.0159   0.0  0.0128  0.0159   \n",
       "\n",
       "       9     ...    1472    1473    1474    1475    1476    1477    1478  \\\n",
       "0    0.0017  ...  0.0957  0.0365  0.0365  0.0779  0.0365  0.0215  0.0611   \n",
       "1    0.0061  ...  0.1105  0.0834  0.0834  0.0855  0.0834  0.0275  1.0000   \n",
       "2    0.0061  ...  0.1105  0.0834  0.0834  0.0855  0.0834  0.0275  1.0000   \n",
       "3    0.0026  ...  0.0529  0.0384  0.0384  0.0424  0.0384  0.0282  0.0369   \n",
       "4    0.0000  ...  0.1402  0.0763  0.0763  0.1018  0.0763  0.0292  1.0000   \n",
       "..      ...  ...     ...     ...     ...     ...     ...     ...     ...   \n",
       "788  0.0016  ...  0.0978  0.0758  0.0758  0.0851  0.0758  0.0373  0.0967   \n",
       "789  0.0000  ...  0.1089  0.0316  0.0316  0.0956  0.0316  0.0491  0.0762   \n",
       "790  0.0000  ...  0.1288  0.0835  0.0835  0.1011  0.0835  0.0175  0.0885   \n",
       "791  0.0017  ...  0.0967  0.0348  0.0348  0.0789  0.0348  0.0224  0.0584   \n",
       "792  0.0005  ...  0.0996  0.0771  0.0771  0.0842  0.0771  0.0410  0.0948   \n",
       "\n",
       "       1479    1480   1481  \n",
       "0    0.0022  0.0661  0.000  \n",
       "1    0.0119  0.0854  0.000  \n",
       "2    0.0119  0.0854  0.000  \n",
       "3    0.0120  0.0554  0.002  \n",
       "4    0.0077  0.1003  0.000  \n",
       "..      ...     ...    ...  \n",
       "788  0.0155  0.0852  0.000  \n",
       "789  0.0157  0.1003  0.000  \n",
       "790  0.0051  0.0871  0.000  \n",
       "791  0.0023  0.0636  0.000  \n",
       "792  0.0197  0.0930  0.001  \n",
       "\n",
       "[793 rows x 1482 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sc=pd.DataFrame(score.T)\n",
    "sc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "7914f48c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>1472</th>\n",
       "      <th>1473</th>\n",
       "      <th>1474</th>\n",
       "      <th>1475</th>\n",
       "      <th>1476</th>\n",
       "      <th>1477</th>\n",
       "      <th>1478</th>\n",
       "      <th>1479</th>\n",
       "      <th>1480</th>\n",
       "      <th>1481</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "      <td>793.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>0.014496</td>\n",
       "      <td>0.011758</td>\n",
       "      <td>0.001530</td>\n",
       "      <td>0.013665</td>\n",
       "      <td>0.006955</td>\n",
       "      <td>0.018708</td>\n",
       "      <td>0.023129</td>\n",
       "      <td>0.005859</td>\n",
       "      <td>0.033506</td>\n",
       "      <td>0.002284</td>\n",
       "      <td>...</td>\n",
       "      <td>0.143214</td>\n",
       "      <td>0.072247</td>\n",
       "      <td>0.108942</td>\n",
       "      <td>0.091020</td>\n",
       "      <td>0.067100</td>\n",
       "      <td>0.055545</td>\n",
       "      <td>0.140586</td>\n",
       "      <td>0.036275</td>\n",
       "      <td>0.136995</td>\n",
       "      <td>0.006564</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.104898</td>\n",
       "      <td>0.067128</td>\n",
       "      <td>0.035584</td>\n",
       "      <td>0.093039</td>\n",
       "      <td>0.063036</td>\n",
       "      <td>0.062413</td>\n",
       "      <td>0.149049</td>\n",
       "      <td>0.051599</td>\n",
       "      <td>0.145239</td>\n",
       "      <td>0.037097</td>\n",
       "      <td>...</td>\n",
       "      <td>0.214091</td>\n",
       "      <td>0.103905</td>\n",
       "      <td>0.212597</td>\n",
       "      <td>0.103062</td>\n",
       "      <td>0.074005</td>\n",
       "      <td>0.144319</td>\n",
       "      <td>0.241689</td>\n",
       "      <td>0.146198</td>\n",
       "      <td>0.222055</td>\n",
       "      <td>0.079311</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.041700</td>\n",
       "      <td>0.015200</td>\n",
       "      <td>0.015200</td>\n",
       "      <td>0.033300</td>\n",
       "      <td>0.015200</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.039600</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.040100</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005300</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.005300</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.092100</td>\n",
       "      <td>0.059600</td>\n",
       "      <td>0.059600</td>\n",
       "      <td>0.078400</td>\n",
       "      <td>0.059600</td>\n",
       "      <td>0.033300</td>\n",
       "      <td>0.080700</td>\n",
       "      <td>0.006100</td>\n",
       "      <td>0.079300</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.016300</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.016300</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.136400</td>\n",
       "      <td>0.095200</td>\n",
       "      <td>0.097200</td>\n",
       "      <td>0.111800</td>\n",
       "      <td>0.095200</td>\n",
       "      <td>0.049800</td>\n",
       "      <td>0.116900</td>\n",
       "      <td>0.019700</td>\n",
       "      <td>0.118700</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 1482 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             0           1           2           3           4           5     \\\n",
       "count  793.000000  793.000000  793.000000  793.000000  793.000000  793.000000   \n",
       "mean     0.014496    0.011758    0.001530    0.013665    0.006955    0.018708   \n",
       "std      0.104898    0.067128    0.035584    0.093039    0.063036    0.062413   \n",
       "min      0.000000    0.000000    0.000000    0.000000    0.000000    0.000000   \n",
       "25%      0.000000    0.000000    0.000000    0.000000    0.000000    0.000000   \n",
       "50%      0.000000    0.000000    0.000000    0.000000    0.000000    0.005300   \n",
       "75%      0.000000    0.000000    0.000000    0.000000    0.000000    0.016300   \n",
       "max      1.000000    1.000000    1.000000    1.000000    1.000000    1.000000   \n",
       "\n",
       "             6           7           8           9     ...        1472  \\\n",
       "count  793.000000  793.000000  793.000000  793.000000  ...  793.000000   \n",
       "mean     0.023129    0.005859    0.033506    0.002284  ...    0.143214   \n",
       "std      0.149049    0.051599    0.145239    0.037097  ...    0.214091   \n",
       "min      0.000000    0.000000    0.000000    0.000000  ...    0.000000   \n",
       "25%      0.000000    0.000000    0.000000    0.000000  ...    0.041700   \n",
       "50%      0.000000    0.000000    0.005300    0.000000  ...    0.092100   \n",
       "75%      0.000000    0.000000    0.016300    0.000000  ...    0.136400   \n",
       "max      1.000000    1.000000    1.000000    1.000000  ...    1.000000   \n",
       "\n",
       "             1473        1474        1475        1476        1477        1478  \\\n",
       "count  793.000000  793.000000  793.000000  793.000000  793.000000  793.000000   \n",
       "mean     0.072247    0.108942    0.091020    0.067100    0.055545    0.140586   \n",
       "std      0.103905    0.212597    0.103062    0.074005    0.144319    0.241689   \n",
       "min      0.000000    0.000000    0.000000    0.000000    0.000000    0.000000   \n",
       "25%      0.015200    0.015200    0.033300    0.015200    0.000000    0.039600   \n",
       "50%      0.059600    0.059600    0.078400    0.059600    0.033300    0.080700   \n",
       "75%      0.095200    0.097200    0.111800    0.095200    0.049800    0.116900   \n",
       "max      1.000000    1.000000    1.000000    1.000000    1.000000    1.000000   \n",
       "\n",
       "             1479        1480        1481  \n",
       "count  793.000000  793.000000  793.000000  \n",
       "mean     0.036275    0.136995    0.006564  \n",
       "std      0.146198    0.222055    0.079311  \n",
       "min      0.000000    0.000000    0.000000  \n",
       "25%      0.000000    0.040100    0.000000  \n",
       "50%      0.006100    0.079300    0.000000  \n",
       "75%      0.019700    0.118700    0.000000  \n",
       "max      1.000000    1.000000    1.000000  \n",
       "\n",
       "[8 rows x 1482 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sc.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "83f102c5",
   "metadata": {},
   "source": [
    "## 1.阈值上界测试"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "e936d998",
   "metadata": {},
   "outputs": [],
   "source": [
    "flag=[[1]*num_dis for _ in range(num_drug)]\n",
    "# 样本标记函数flag\n",
    "def judge(flag,threshold1):\n",
    "    countp=0\n",
    "    counte=0\n",
    "    countf=0\n",
    "    for i in range(num_drug):\n",
    "        for j in range(num_dis):\n",
    "            if us[i][j]==1:  #正例\n",
    "                flag[i][j]=3\n",
    "                countp+=1\n",
    "                continue\n",
    "            if score[i][j]==0:  #随机样本\n",
    "                flag[i][j]=0\n",
    "                counte+=1\n",
    "                continue\n",
    "            if score[i][j]>=threshold1:  #伪负样本\n",
    "                flag[i][j]=2\n",
    "                countf+=1\n",
    "                continue\n",
    "    print(\"已知的正样本的数量为:\",countp)\n",
    "    print(\"伪负样本的数量为：\",countf)\n",
    "    print(\"强负样本的数量为：\",num_drug*num_dis-countp-counte-countf)\n",
    "    print(\"简单负样本的数量为：\",counte)\n",
    "    \n",
    "    \n",
    "    return flag\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "64f06858",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1036\n",
      "强负样本的数量为： 616191\n",
      "简单负样本的数量为： 546459\n",
      "当前阈值为: 0.35\n"
     ]
    }
   ],
   "source": [
    "threshold1=0.35\n",
    "judge(flag,threshold1)\n",
    "print(\"当前阈值为:\",threshold1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "809f7b08",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1136\n",
      "强负样本的数量为： 616091\n",
      "简单负样本的数量为： 546459\n",
      "当前阈值为: 0.34\n"
     ]
    }
   ],
   "source": [
    "threshold1=0.34\n",
    "judge(flag,threshold1)\n",
    "print(\"当前阈值为:\",threshold1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "7beb4fba",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1165\n",
      "强负样本的数量为： 616062\n",
      "简单负样本的数量为： 546459\n",
      "当前阈值为: 0.335\n"
     ]
    }
   ],
   "source": [
    "threshold1=0.335\n",
    "judge(flag,threshold1)\n",
    "print(\"当前阈值为:\",threshold1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "3c92bcb1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1682\n",
      "强负样本的数量为： 615545\n",
      "简单负样本的数量为： 546459\n",
      "当前阈值为: 0.33\n"
     ]
    }
   ],
   "source": [
    "threshold1=0.33\n",
    "judge(flag,threshold1)\n",
    "print(\"当前阈值为:\",threshold1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "6b04514e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1797\n",
      "强负样本的数量为： 615430\n",
      "简单负样本的数量为： 546459\n",
      "当前阈值为: 0.32\n"
     ]
    }
   ],
   "source": [
    "threshold1=0.32\n",
    "judge(flag,threshold1)\n",
    "print(\"当前阈值为:\",threshold1)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "f6140150",
   "metadata": {},
   "source": [
    "选定阈值上界为0.335"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "27c2bccc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1165\n",
      "强负样本的数量为： 616062\n",
      "简单负样本的数量为： 546459\n",
      "当前阈值为: 0.335\n"
     ]
    }
   ],
   "source": [
    "threshold1=0.335\n",
    "judge(flag,threshold1)\n",
    "print(\"当前阈值为:\",threshold1)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e64f8a12",
   "metadata": {},
   "source": [
    "## 2.阈值下界测试"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "fd05042a",
   "metadata": {},
   "outputs": [],
   "source": [
    "flag=[[1]*num_dis for _ in range(num_drug)]\n",
    "def judge2(flag,threshold1,threshold2):\n",
    "    countp=0\n",
    "    counte=0\n",
    "    countf=0\n",
    "    for i in range(num_drug):\n",
    "        for j in range(num_dis):\n",
    "            if us[i][j]==1:\n",
    "                flag[i][j]=3\n",
    "                countp+=1\n",
    "                continue\n",
    "            if score[i][j]>=threshold1:\n",
    "                flag[i][j]=2\n",
    "                countf+=1\n",
    "                continue\n",
    "            if score[i][j]<=threshold2:\n",
    "                flag[i][j]=0\n",
    "                counte+=1\n",
    "                continue            \n",
    "    print(\"已知的正样本的数量为:\",countp)\n",
    "    print(\"伪负样本的数量为：\",countf)\n",
    "    print(\"强负样本的数量为：\",num_drug*num_dis-countp-counte-countf)\n",
    "    print(\"简单负样本的数量为：\",counte)    \n",
    "    return flag"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "0cb8ce50",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1165\n",
      "强负样本的数量为： 60705\n",
      "简单负样本的数量为： 1101816\n",
      "当前阈值为:[0.120,0.335]\n"
     ]
    }
   ],
   "source": [
    "threshold1,threshold2=0.335,0.12\n",
    "flag = judge2(flag,threshold1,threshold2)\n",
    "print(\"当前阈值为:[%.3f,%.3f]\"%(threshold2,threshold1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "f3e527b0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1165\n",
      "强负样本的数量为： 59576\n",
      "简单负样本的数量为： 1102945\n",
      "当前阈值为:[0.121,0.335]\n"
     ]
    }
   ],
   "source": [
    "threshold1,threshold2=0.335,0.121\n",
    "flag = judge2(flag,threshold1,threshold2)\n",
    "print(\"当前阈值为:[%.3f,%.3f]\"%(threshold2,threshold1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "e646b398",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1165\n",
      "强负样本的数量为： 58224\n",
      "简单负样本的数量为： 1104297\n",
      "当前阈值为:[0.122,0.335]\n"
     ]
    }
   ],
   "source": [
    "threshold1,threshold2=0.335,0.122\n",
    "flag = judge2(flag,threshold1,threshold2)\n",
    "print(\"当前阈值为:[%.3f,%.3f]\"%(threshold2,threshold1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "dd7db2d2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1165\n",
      "强负样本的数量为： 57079\n",
      "简单负样本的数量为： 1105442\n",
      "当前阈值为:[0.123,0.335]\n"
     ]
    }
   ],
   "source": [
    "threshold1,threshold2=0.335,0.123\n",
    "flag = judge2(flag,threshold1,threshold2)\n",
    "print(\"当前阈值为:[%.3f,%.3f]\"%(threshold2,threshold1))"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "3364eba1",
   "metadata": {},
   "source": [
    "## 3.基于选定的阈值范围[0.121,0.335]进行负采样"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "860c002d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已知的正样本的数量为: 11540\n",
      "伪负样本的数量为： 1165\n",
      "强负样本的数量为： 59576\n",
      "简单负样本的数量为： 1102945\n",
      "当前阈值为:[0.121,0.335]\n"
     ]
    }
   ],
   "source": [
    "threshold1,threshold2=0.335,0.121\n",
    "flag = judge2(flag,threshold1,threshold2)\n",
    "print(\"当前阈值为:[%.3f,%.3f]\"%(threshold2,threshold1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "4424f4f4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[3, 99, 1, 2, 7]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=[1,2,3,7,5,99,6]\n",
    "np.random.seed(77)\n",
    "np.random.choice(a, 5, replace=False).tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "71d93a83",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "采取当前阈值时，不存在强负样本的药物数量： 287\n"
     ]
    }
   ],
   "source": [
    "from collections import defaultdict\n",
    "def selectNS(flag):\n",
    "    #hard negtaive samples, hard negative number\n",
    "    hns=defaultdict(list)\n",
    "    hnn=defaultdict(int)\n",
    "    #easy negtaive samples, easy negative number\n",
    "    ens=defaultdict(list)\n",
    "    enn=defaultdict(int)\n",
    "    #record:记录有多少个药物节点没有强负样本\n",
    "    record=0\n",
    "    np.random.seed(77)\n",
    "    for i in range(num_drug):\n",
    "        for j in range(num_dis):\n",
    "            if flag[i][j]==1:\n",
    "                hns[i].append(j)\n",
    "            if flag[i][j]==0:\n",
    "                ens[i].append(j)\n",
    "        hnn[i]=len(hns[i])\n",
    "        enn[i]=len(ens[i])\n",
    "        #当前节点不存在强负样本，需从简单负样本集进行随机选取\n",
    "        if hnn[i]==0:\n",
    "            record+=1\n",
    "            rns=np.random.choice(ens[i], hardnegatives, replace=False).tolist()\n",
    "            #print(i,rns)\n",
    "            hns[i]=rns\n",
    "            hnn[i]=hardnegatives\n",
    "            continue\n",
    "        #当前节点的强负样本数量过多，对其进行随机筛选\n",
    "        if hnn[i]>hardnegatives:\n",
    "            rns=np.random.choice(hns[i], hardnegatives, replace=False).tolist()\n",
    "            hns[i]=rns\n",
    "            #print(i,rns)\n",
    "            hnn[i]=hardnegatives\n",
    "    print(\"采取当前阈值时，不存在强负样本的药物数量：\",record)\n",
    "    #print(hns)\n",
    "    #print(hnn)\n",
    "    return hnn,hns\n",
    "hnn,hns=selectNS(flag)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "79088189",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "304"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hns[1481][-1]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "51f6a7f0",
   "metadata": {},
   "source": [
    "## 4.生成实验用的数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "b73a1e8e",
   "metadata": {},
   "outputs": [],
   "source": [
    "np.random.seed(2023)\n",
    "# save_prefix = './preprocess_NSAP/'\n",
    "num_drug = 1482\n",
    "num_dis = 793\n",
    "drug_dis = np.load('./raw/txt2npy/us_edges.npy')\n",
    "train_val_test_idx = np.load('./raw/txt2npz/train_val_test_idx.npz')\n",
    "train_idx = train_val_test_idx['train_idx']\n",
    "val_idx = train_val_test_idx['val_idx']\n",
    "test_idx = train_val_test_idx['test_idx']    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "ebf1770d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[0, 1], [0, 2], [0, 3], [0, 4]]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#将b由数组转换为4*1的矩阵\n",
    "b=np.array([1,2,3,4])[:,np.newaxis]\n",
    "a=np.array([0]*len(b))[:,np.newaxis]\n",
    "# c=np.hstack((a,b))\n",
    "# d=np.vstack((a,b))\n",
    "np.concatenate((a,b),axis=1).tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "e103c86b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "35258\n"
     ]
    }
   ],
   "source": [
    "neg_candidates = []\n",
    "counter=0\n",
    "for drug,dis_nslist in hns.items():\n",
    "    for dis in dis_nslist:\n",
    "        neg_candidates.append([drug,dis])\n",
    "print(len(neg_candidates))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "e3610f13",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 4 5]\n"
     ]
    }
   ],
   "source": [
    "a=np.array([1,2,3,4,5])\n",
    "b=np.array([2,3])\n",
    "diff=np.setdiff1d(a,b)  \n",
    "print(diff)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "da93e2d0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 5841 16728 11563 ... 31100 31840 19980]\n",
      "4616\n"
     ]
    }
   ],
   "source": [
    "neg_candidates=np.array(neg_candidates)\n",
    "# 随机选择验证集和测试集\n",
    "idx = np.random.choice(len(neg_candidates), len(val_idx) + len(test_idx), replace=False)\n",
    "val_neg_candidates = neg_candidates[sorted(idx[:len(val_idx)])]\n",
    "test_neg_candidates = neg_candidates[sorted(idx[len(val_idx):])]\n",
    "print(idx)\n",
    "print(len(idx))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "9f1c7993",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "30642\n",
      "[    0     1     2 ... 35255 35256 35257]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([1270,  408])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=np.arange(len(neg_candidates))\n",
    "b=np.array(idx)\n",
    "other_idx=np.setdiff1d(a,b) \n",
    "train_neg_candidates =neg_candidates[other_idx]\n",
    "print(len(train_neg_candidates))\n",
    "print(other_idx)\n",
    "neg_candidates[29258]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "bbe34ce7",
   "metadata": {},
   "outputs": [],
   "source": [
    "save_prefix = './'\n",
    "np.savez(save_prefix + 'dd_ns_train_val_test_pos_drug_dis.npz',\n",
    "         train_pos_drug_dis=drug_dis[train_idx],\n",
    "         val_pos_drug_dis=drug_dis[val_idx],\n",
    "         test_pos_drug_dis=drug_dis[test_idx])\n",
    "np.savez(save_prefix + 'dd_ns_train_val_test_neg_drug_dis.npz',\n",
    "         train_neg_drug_dis=train_neg_candidates,\n",
    "         val_neg_drug_dis=val_neg_candidates,\n",
    "         test_neg_drug_dis=test_neg_candidates)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0f79a6d6",
   "metadata": {},
   "source": [
    "# metapath2vec label生成 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "6422c328",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[   1,  279],\n",
       "       [   2,  598],\n",
       "       [   2,   38],\n",
       "       ...,\n",
       "       [1480,  204],\n",
       "       [1480,  203],\n",
       "       [1481,   65]])"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_neg_candidates "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "e0410663",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['u1', 's279', 0],\n",
       " ['u2', 's598', 0],\n",
       " ['u2', 's38', 0],\n",
       " ['u5', 's137', 0],\n",
       " ['u6', 's692', 0],\n",
       " ['u6', 's73', 0],\n",
       " ['u6', 's510', 0],\n",
       " ['u6', 's129', 0],\n",
       " ['u6', 's757', 0],\n",
       " ['u11', 's237', 0],\n",
       " ['u13', 's29', 0],\n",
       " ['u13', 's522', 0],\n",
       " ['u13', 's136', 0],\n",
       " ['u13', 's130', 0],\n",
       " ['u15', 's630', 0],\n",
       " ['u17', 's430', 0],\n",
       " ['u17', 's358', 0],\n",
       " ['u17', 's704', 0],\n",
       " ['u17', 's498', 0],\n",
       " ['u17', 's355', 0],\n",
       " ['u18', 's734', 0],\n",
       " ['u19', 's378', 0],\n",
       " ['u19', 's347', 0],\n",
       " ['u19', 's693', 0],\n",
       " ['u20', 's321', 0],\n",
       " ['u20', 's663', 0],\n",
       " ['u25', 's251', 0],\n",
       " ['u25', 's150', 0],\n",
       " ['u26', 's751', 0],\n",
       " ['u26', 's520', 0],\n",
       " ['u26', 's73', 0],\n",
       " ['u28', 's35', 0],\n",
       " ['u28', 's785', 0],\n",
       " ['u29', 's261', 0],\n",
       " ['u29', 's754', 0],\n",
       " ['u29', 's259', 0],\n",
       " ['u31', 's530', 0],\n",
       " ['u32', 's268', 0],\n",
       " ['u32', 's36', 0],\n",
       " ['u33', 's639', 0],\n",
       " ['u33', 's680', 0],\n",
       " ['u34', 's120', 0],\n",
       " ['u35', 's610', 0],\n",
       " ['u35', 's718', 0],\n",
       " ['u36', 's159', 0],\n",
       " ['u36', 's593', 0],\n",
       " ['u36', 's303', 0],\n",
       " ['u36', 's550', 0],\n",
       " ['u40', 's138', 0],\n",
       " ['u40', 's439', 0],\n",
       " ['u41', 's212', 0],\n",
       " ['u42', 's104', 0],\n",
       " ['u42', 's356', 0],\n",
       " ['u42', 's112', 0],\n",
       " ['u42', 's721', 0],\n",
       " ['u45', 's590', 0],\n",
       " ['u46', 's36', 0],\n",
       " ['u46', 's193', 0],\n",
       " ['u46', 's687', 0],\n",
       " ['u46', 's116', 0],\n",
       " ['u46', 's735', 0],\n",
       " ['u48', 's62', 0],\n",
       " ['u49', 's34', 0],\n",
       " ['u51', 's387', 0],\n",
       " ['u51', 's610', 0],\n",
       " ['u51', 's164', 0],\n",
       " ['u51', 's697', 0],\n",
       " ['u51', 's42', 0],\n",
       " ['u55', 's138', 0],\n",
       " ['u55', 's766', 0],\n",
       " ['u55', 's66', 0],\n",
       " ['u56', 's305', 0],\n",
       " ['u56', 's409', 0],\n",
       " ['u57', 's766', 0],\n",
       " ['u57', 's71', 0],\n",
       " ['u59', 's564', 0],\n",
       " ['u60', 's330', 0],\n",
       " ['u60', 's50', 0],\n",
       " ['u61', 's590', 0],\n",
       " ['u62', 's112', 0],\n",
       " ['u62', 's444', 0],\n",
       " ['u63', 's551', 0],\n",
       " ['u65', 's545', 0],\n",
       " ['u67', 's400', 0],\n",
       " ['u67', 's594', 0],\n",
       " ['u68', 's613', 0],\n",
       " ['u72', 's10', 0],\n",
       " ['u72', 's151', 0],\n",
       " ['u72', 's85', 0],\n",
       " ['u73', 's407', 0],\n",
       " ['u73', 's298', 0],\n",
       " ['u74', 's424', 0],\n",
       " ['u74', 's46', 0],\n",
       " ['u74', 's12', 0],\n",
       " ['u75', 's636', 0],\n",
       " ['u75', 's86', 0],\n",
       " ['u76', 's509', 0],\n",
       " ['u76', 's547', 0],\n",
       " ['u76', 's105', 0],\n",
       " ['u77', 's763', 0],\n",
       " ['u77', 's248', 0],\n",
       " ['u77', 's651', 0],\n",
       " ['u77', 's701', 0],\n",
       " ['u77', 's521', 0],\n",
       " ['u77', 's90', 0],\n",
       " ['u78', 's194', 0],\n",
       " ['u78', 's760', 0],\n",
       " ['u78', 's758', 0],\n",
       " ['u78', 's422', 0],\n",
       " ['u79', 's653', 0],\n",
       " ['u79', 's258', 0],\n",
       " ['u79', 's708', 0],\n",
       " ['u80', 's485', 0],\n",
       " ['u80', 's364', 0],\n",
       " ['u81', 's435', 0],\n",
       " ['u81', 's735', 0],\n",
       " ['u82', 's331', 0],\n",
       " ['u83', 's501', 0],\n",
       " ['u83', 's301', 0],\n",
       " ['u83', 's556', 0],\n",
       " ['u84', 's779', 0],\n",
       " ['u85', 's727', 0],\n",
       " ['u85', 's605', 0],\n",
       " ['u86', 's242', 0],\n",
       " ['u86', 's114', 0],\n",
       " ['u86', 's773', 0],\n",
       " ['u87', 's422', 0],\n",
       " ['u89', 's394', 0],\n",
       " ['u89', 's393', 0],\n",
       " ['u89', 's746', 0],\n",
       " ['u89', 's121', 0],\n",
       " ['u89', 's92', 0],\n",
       " ['u92', 's530', 0],\n",
       " ['u92', 's444', 0],\n",
       " ['u92', 's589', 0],\n",
       " ['u92', 's579', 0],\n",
       " ['u94', 's773', 0],\n",
       " ['u95', 's31', 0],\n",
       " ['u95', 's460', 0],\n",
       " ['u96', 's267', 0],\n",
       " ['u96', 's651', 0],\n",
       " ['u96', 's47', 0],\n",
       " ['u96', 's42', 0],\n",
       " ['u96', 's32', 0],\n",
       " ['u96', 's663', 0],\n",
       " ['u96', 's345', 0],\n",
       " ['u99', 's499', 0],\n",
       " ['u100', 's341', 0],\n",
       " ['u100', 's617', 0],\n",
       " ['u101', 's284', 0],\n",
       " ['u101', 's56', 0],\n",
       " ['u101', 's66', 0],\n",
       " ['u102', 's448', 0],\n",
       " ['u105', 's415', 0],\n",
       " ['u106', 's764', 0],\n",
       " ['u106', 's218', 0],\n",
       " ['u106', 's49', 0],\n",
       " ['u106', 's550', 0],\n",
       " ['u106', 's477', 0],\n",
       " ['u109', 's610', 0],\n",
       " ['u109', 's725', 0],\n",
       " ['u111', 's107', 0],\n",
       " ['u111', 's63', 0],\n",
       " ['u111', 's412', 0],\n",
       " ['u113', 's488', 0],\n",
       " ['u113', 's316', 0],\n",
       " ['u113', 's727', 0],\n",
       " ['u116', 's566', 0],\n",
       " ['u117', 's116', 0],\n",
       " ['u117', 's255', 0],\n",
       " ['u117', 's412', 0],\n",
       " ['u120', 's354', 0],\n",
       " ['u120', 's382', 0],\n",
       " ['u121', 's430', 0],\n",
       " ['u121', 's151', 0],\n",
       " ['u121', 's45', 0],\n",
       " ['u121', 's44', 0],\n",
       " ['u122', 's251', 0],\n",
       " ['u122', 's573', 0],\n",
       " ['u122', 's718', 0],\n",
       " ['u123', 's328', 0],\n",
       " ['u123', 's396', 0],\n",
       " ['u124', 's267', 0],\n",
       " ['u124', 's347', 0],\n",
       " ['u124', 's565', 0],\n",
       " ['u125', 's333', 0],\n",
       " ['u126', 's489', 0],\n",
       " ['u127', 's379', 0],\n",
       " ['u127', 's160', 0],\n",
       " ['u127', 's448', 0],\n",
       " ['u127', 's337', 0],\n",
       " ['u128', 's718', 0],\n",
       " ['u128', 's586', 0],\n",
       " ['u128', 's605', 0],\n",
       " ['u129', 's730', 0],\n",
       " ['u129', 's480', 0],\n",
       " ['u130', 's237', 0],\n",
       " ['u130', 's526', 0],\n",
       " ['u131', 's410', 0],\n",
       " ['u132', 's403', 0],\n",
       " ['u133', 's736', 0],\n",
       " ['u133', 's337', 0],\n",
       " ['u133', 's511', 0],\n",
       " ['u133', 's407', 0],\n",
       " ['u133', 's323', 0],\n",
       " ['u134', 's242', 0],\n",
       " ['u136', 's389', 0],\n",
       " ['u136', 's179', 0],\n",
       " ['u136', 's157', 0],\n",
       " ['u136', 's181', 0],\n",
       " ['u136', 's574', 0],\n",
       " ['u136', 's515', 0],\n",
       " ['u137', 's73', 0],\n",
       " ['u137', 's429', 0],\n",
       " ['u139', 's182', 0],\n",
       " ['u139', 's448', 0],\n",
       " ['u139', 's766', 0],\n",
       " ['u139', 's72', 0],\n",
       " ['u141', 's98', 0],\n",
       " ['u141', 's259', 0],\n",
       " ['u143', 's522', 0],\n",
       " ['u143', 's261', 0],\n",
       " ['u145', 's103', 0],\n",
       " ['u145', 's299', 0],\n",
       " ['u145', 's22', 0],\n",
       " ['u146', 's511', 0],\n",
       " ['u146', 's167', 0],\n",
       " ['u146', 's261', 0],\n",
       " ['u147', 's11', 0],\n",
       " ['u147', 's564', 0],\n",
       " ['u148', 's727', 0],\n",
       " ['u148', 's44', 0],\n",
       " ['u149', 's272', 0],\n",
       " ['u149', 's481', 0],\n",
       " ['u149', 's473', 0],\n",
       " ['u149', 's184', 0],\n",
       " ['u150', 's63', 0],\n",
       " ['u150', 's667', 0],\n",
       " ['u150', 's174', 0],\n",
       " ['u152', 's499', 0],\n",
       " ['u152', 's557', 0],\n",
       " ['u154', 's351', 0],\n",
       " ['u154', 's421', 0],\n",
       " ['u154', 's453', 0],\n",
       " ['u154', 's520', 0],\n",
       " ['u154', 's529', 0],\n",
       " ['u154', 's630', 0],\n",
       " ['u155', 's202', 0],\n",
       " ['u155', 's457', 0],\n",
       " ['u156', 's74', 0],\n",
       " ['u156', 's75', 0],\n",
       " ['u156', 's104', 0],\n",
       " ['u156', 's108', 0],\n",
       " ['u156', 's143', 0],\n",
       " ['u156', 's414', 0],\n",
       " ['u157', 's72', 0],\n",
       " ['u160', 's582', 0],\n",
       " ['u162', 's6', 0],\n",
       " ['u162', 's725', 0],\n",
       " ['u164', 's216', 0],\n",
       " ['u164', 's130', 0],\n",
       " ['u164', 's67', 0],\n",
       " ['u164', 's548', 0],\n",
       " ['u165', 's595', 0],\n",
       " ['u165', 's163', 0],\n",
       " ['u165', 's110', 0],\n",
       " ['u165', 's513', 0],\n",
       " ['u165', 's459', 0],\n",
       " ['u166', 's486', 0],\n",
       " ['u169', 's353', 0],\n",
       " ['u169', 's362', 0],\n",
       " ['u173', 's20', 0],\n",
       " ['u173', 's522', 0],\n",
       " ['u177', 's59', 0],\n",
       " ['u177', 's202', 0],\n",
       " ['u178', 's150', 0],\n",
       " ['u180', 's244', 0],\n",
       " ['u180', 's732', 0],\n",
       " ['u180', 's351', 0],\n",
       " ['u182', 's305', 0],\n",
       " ['u183', 's502', 0],\n",
       " ['u183', 's510', 0],\n",
       " ['u183', 's792', 0],\n",
       " ['u183', 's452', 0],\n",
       " ['u183', 's507', 0],\n",
       " ['u183', 's564', 0],\n",
       " ['u184', 's472', 0],\n",
       " ['u184', 's428', 0],\n",
       " ['u185', 's479', 0],\n",
       " ['u185', 's679', 0],\n",
       " ['u185', 's417', 0],\n",
       " ['u186', 's257', 0],\n",
       " ['u186', 's393', 0],\n",
       " ['u190', 's70', 0],\n",
       " ['u191', 's718', 0],\n",
       " ['u191', 's566', 0],\n",
       " ['u191', 's277', 0],\n",
       " ['u191', 's203', 0],\n",
       " ['u191', 's579', 0],\n",
       " ['u192', 's99', 0],\n",
       " ['u192', 's768', 0],\n",
       " ['u196', 's780', 0],\n",
       " ['u196', 's304', 0],\n",
       " ['u197', 's349', 0],\n",
       " ['u197', 's622', 0],\n",
       " ['u197', 's498', 0],\n",
       " ['u197', 's203', 0],\n",
       " ['u197', 's226', 0],\n",
       " ['u198', 's165', 0],\n",
       " ['u198', 's166', 0],\n",
       " ['u200', 's333', 0],\n",
       " ['u200', 's472', 0],\n",
       " ['u201', 's683', 0],\n",
       " ['u202', 's514', 0],\n",
       " ['u202', 's527', 0],\n",
       " ['u203', 's708', 0],\n",
       " ['u204', 's636', 0],\n",
       " ['u204', 's790', 0],\n",
       " ['u204', 's568', 0],\n",
       " ['u205', 's605', 0],\n",
       " ['u208', 's77', 0],\n",
       " ['u208', 's448', 0],\n",
       " ['u210', 's275', 0],\n",
       " ['u211', 's731', 0],\n",
       " ['u211', 's143', 0],\n",
       " ['u211', 's736', 0],\n",
       " ['u214', 's15', 0],\n",
       " ['u216', 's442', 0],\n",
       " ['u220', 's305', 0],\n",
       " ['u220', 's520', 0],\n",
       " ['u221', 's627', 0],\n",
       " ['u222', 's499', 0],\n",
       " ['u222', 's573', 0],\n",
       " ['u223', 's45', 0],\n",
       " ['u223', 's497', 0],\n",
       " ['u224', 's284', 0],\n",
       " ['u224', 's605', 0],\n",
       " ['u224', 's430', 0],\n",
       " ['u224', 's48', 0],\n",
       " ['u224', 's312', 0],\n",
       " ['u225', 's154', 0],\n",
       " ['u226', 's216', 0],\n",
       " ['u226', 's529', 0],\n",
       " ['u226', 's685', 0],\n",
       " ['u226', 's658', 0],\n",
       " ['u227', 's275', 0],\n",
       " ['u228', 's288', 0],\n",
       " ['u228', 's56', 0],\n",
       " ['u228', 's256', 0],\n",
       " ['u228', 's718', 0],\n",
       " ['u230', 's391', 0],\n",
       " ['u230', 's99', 0],\n",
       " ['u230', 's499', 0],\n",
       " ['u230', 's301', 0],\n",
       " ['u230', 's419', 0],\n",
       " ['u230', 's143', 0],\n",
       " ['u231', 's786', 0],\n",
       " ['u231', 's528', 0],\n",
       " ['u231', 's419', 0],\n",
       " ['u231', 's663', 0],\n",
       " ['u231', 's601', 0],\n",
       " ['u231', 's586', 0],\n",
       " ['u232', 's493', 0],\n",
       " ['u232', 's316', 0],\n",
       " ['u232', 's736', 0],\n",
       " ['u232', 's270', 0],\n",
       " ['u232', 's589', 0],\n",
       " ['u233', 's301', 0],\n",
       " ['u233', 's151', 0],\n",
       " ['u233', 's171', 0],\n",
       " ['u235', 's301', 0],\n",
       " ['u236', 's598', 0],\n",
       " ['u237', 's309', 0],\n",
       " ['u237', 's44', 0],\n",
       " ['u237', 's643', 0],\n",
       " ['u238', 's347', 0],\n",
       " ['u239', 's32', 0],\n",
       " ['u239', 's415', 0],\n",
       " ['u239', 's442', 0],\n",
       " ['u239', 's300', 0],\n",
       " ['u239', 's361', 0],\n",
       " ['u239', 's330', 0],\n",
       " ['u241', 's242', 0],\n",
       " ['u241', 's110', 0],\n",
       " ['u242', 's37', 0],\n",
       " ['u243', 's591', 0],\n",
       " ['u243', 's709', 0],\n",
       " ['u243', 's682', 0],\n",
       " ['u245', 's69', 0],\n",
       " ['u246', 's253', 0],\n",
       " ['u246', 's413', 0],\n",
       " ['u248', 's370', 0],\n",
       " ['u249', 's164', 0],\n",
       " ['u251', 's568', 0],\n",
       " ['u252', 's674', 0],\n",
       " ['u253', 's163', 0],\n",
       " ['u254', 's659', 0],\n",
       " ['u255', 's305', 0],\n",
       " ['u255', 's361', 0],\n",
       " ['u255', 's428', 0],\n",
       " ['u255', 's454', 0],\n",
       " ['u255', 's467', 0],\n",
       " ['u255', 's527', 0],\n",
       " ['u256', 's325', 0],\n",
       " ['u256', 's48', 0],\n",
       " ['u256', 's446', 0],\n",
       " ['u257', 's415', 0],\n",
       " ['u258', 's171', 0],\n",
       " ['u258', 's396', 0],\n",
       " ['u259', 's77', 0],\n",
       " ['u261', 's598', 0],\n",
       " ['u264', 's465', 0],\n",
       " ['u264', 's642', 0],\n",
       " ['u265', 's637', 0],\n",
       " ['u266', 's570', 0],\n",
       " ['u267', 's44', 0],\n",
       " ['u267', 's778', 0],\n",
       " ['u268', 's364', 0],\n",
       " ['u270', 's62', 0],\n",
       " ['u270', 's59', 0],\n",
       " ['u270', 's432', 0],\n",
       " ['u272', 's617', 0],\n",
       " ['u272', 's489', 0],\n",
       " ['u272', 's605', 0],\n",
       " ['u272', 's251', 0],\n",
       " ['u275', 's101', 0],\n",
       " ['u276', 's512', 0],\n",
       " ['u277', 's718', 0],\n",
       " ['u277', 's446', 0],\n",
       " ['u280', 's383', 0],\n",
       " ['u282', 's566', 0],\n",
       " ['u283', 's242', 0],\n",
       " ['u286', 's514', 0],\n",
       " ['u286', 's586', 0],\n",
       " ['u287', 's71', 0],\n",
       " ['u288', 's273', 0],\n",
       " ['u288', 's449', 0],\n",
       " ['u289', 's434', 0],\n",
       " ['u289', 's342', 0],\n",
       " ['u289', 's235', 0],\n",
       " ['u293', 's427', 0],\n",
       " ['u293', 's454', 0],\n",
       " ['u293', 's305', 0],\n",
       " ['u295', 's463', 0],\n",
       " ['u297', 's338', 0],\n",
       " ['u297', 's413', 0],\n",
       " ['u297', 's626', 0],\n",
       " ['u298', 's77', 0],\n",
       " ['u298', 's508', 0],\n",
       " ['u299', 's610', 0],\n",
       " ['u303', 's337', 0],\n",
       " ['u303', 's501', 0],\n",
       " ['u303', 's181', 0],\n",
       " ['u304', 's315', 0],\n",
       " ['u304', 's780', 0],\n",
       " ['u304', 's700', 0],\n",
       " ['u304', 's586', 0],\n",
       " ['u304', 's60', 0],\n",
       " ['u304', 's711', 0],\n",
       " ['u304', 's397', 0],\n",
       " ['u304', 's445', 0],\n",
       " ['u304', 's67', 0],\n",
       " ['u304', 's724', 0],\n",
       " ['u306', 's195', 0],\n",
       " ['u306', 's179', 0],\n",
       " ['u307', 's588', 0],\n",
       " ['u309', 's110', 0],\n",
       " ['u309', 's354', 0],\n",
       " ['u309', 's531', 0],\n",
       " ['u310', 's403', 0],\n",
       " ['u310', 's261', 0],\n",
       " ['u310', 's515', 0],\n",
       " ['u313', 's637', 0],\n",
       " ['u314', 's454', 0],\n",
       " ['u314', 's517', 0],\n",
       " ['u314', 's569', 0],\n",
       " ['u315', 's674', 0],\n",
       " ['u315', 's130', 0],\n",
       " ['u315', 's43', 0],\n",
       " ['u317', 's108', 0],\n",
       " ['u317', 's237', 0],\n",
       " ['u317', 's511', 0],\n",
       " ['u318', 's383', 0],\n",
       " ['u319', 's430', 0],\n",
       " ['u319', 's297', 0],\n",
       " ['u319', 's192', 0],\n",
       " ['u320', 's443', 0],\n",
       " ['u321', 's77', 0],\n",
       " ['u322', 's266', 0],\n",
       " ['u323', 's581', 0],\n",
       " ['u324', 's439', 0],\n",
       " ['u325', 's18', 0],\n",
       " ['u325', 's660', 0],\n",
       " ['u325', 's718', 0],\n",
       " ['u327', 's468', 0],\n",
       " ['u327', 's391', 0],\n",
       " ['u327', 's42', 0],\n",
       " ['u327', 's562', 0],\n",
       " ['u328', 's410', 0],\n",
       " ['u328', 's403', 0],\n",
       " ['u328', 's584', 0],\n",
       " ['u328', 's571', 0],\n",
       " ['u329', 's69', 0],\n",
       " ['u330', 's569', 0],\n",
       " ['u330', 's105', 0],\n",
       " ['u331', 's362', 0],\n",
       " ['u332', 's143', 0],\n",
       " ['u332', 's169', 0],\n",
       " ['u332', 's515', 0],\n",
       " ['u332', 's766', 0],\n",
       " ['u332', 's514', 0],\n",
       " ['u333', 's74', 0],\n",
       " ['u333', 's732', 0],\n",
       " ['u334', 's49', 0],\n",
       " ['u334', 's792', 0],\n",
       " ['u335', 's685', 0],\n",
       " ['u336', 's593', 0],\n",
       " ['u336', 's277', 0],\n",
       " ['u336', 's235', 0],\n",
       " ['u337', 's66', 0],\n",
       " ['u337', 's473', 0],\n",
       " ['u337', 's307', 0],\n",
       " ['u337', 's501', 0],\n",
       " ['u340', 's519', 0],\n",
       " ['u342', 's571', 0],\n",
       " ['u342', 's573', 0],\n",
       " ['u344', 's373', 0],\n",
       " ['u346', 's787', 0],\n",
       " ['u347', 's301', 0],\n",
       " ['u347', 's202', 0],\n",
       " ['u347', 's333', 0],\n",
       " ['u351', 's573', 0],\n",
       " ['u351', 's718', 0],\n",
       " ['u351', 's627', 0],\n",
       " ['u352', 's727', 0],\n",
       " ['u352', 's340', 0],\n",
       " ['u352', 's457', 0],\n",
       " ['u352', 's251', 0],\n",
       " ['u352', 's40', 0],\n",
       " ['u352', 's623', 0],\n",
       " ['u353', 's481', 0],\n",
       " ['u353', 's409', 0],\n",
       " ['u353', 's26', 0],\n",
       " ['u354', 's576', 0],\n",
       " ['u354', 's738', 0],\n",
       " ['u356', 's254', 0],\n",
       " ['u359', 's588', 0],\n",
       " ['u359', 's623', 0],\n",
       " ['u360', 's482', 0],\n",
       " ['u362', 's573', 0],\n",
       " ['u363', 's600', 0],\n",
       " ['u365', 's614', 0],\n",
       " ['u367', 's329', 0],\n",
       " ['u369', 's529', 0],\n",
       " ['u370', 's307', 0],\n",
       " ['u372', 's690', 0],\n",
       " ['u372', 's59', 0],\n",
       " ['u373', 's466', 0],\n",
       " ['u373', 's499', 0],\n",
       " ['u373', 's220', 0],\n",
       " ['u375', 's547', 0],\n",
       " ['u376', 's617', 0],\n",
       " ['u376', 's202', 0],\n",
       " ['u376', 's69', 0],\n",
       " ['u376', 's271', 0],\n",
       " ['u377', 's505', 0],\n",
       " ['u378', 's56', 0],\n",
       " ['u379', 's401', 0],\n",
       " ['u380', 's508', 0],\n",
       " ['u382', 's99', 0],\n",
       " ['u382', 's434', 0],\n",
       " ['u385', 's720', 0],\n",
       " ['u387', 's148', 0],\n",
       " ['u387', 's568', 0],\n",
       " ['u387', 's783', 0],\n",
       " ['u387', 's414', 0],\n",
       " ['u387', 's15', 0],\n",
       " ['u389', 's375', 0],\n",
       " ['u390', 's581', 0],\n",
       " ['u390', 's34', 0],\n",
       " ['u390', 's340', 0],\n",
       " ['u392', 's664', 0],\n",
       " ['u392', 's786', 0],\n",
       " ['u392', 's661', 0],\n",
       " ['u392', 's338', 0],\n",
       " ['u393', 's655', 0],\n",
       " ['u393', 's266', 0],\n",
       " ['u393', 's524', 0],\n",
       " ['u394', 's302', 0],\n",
       " ['u394', 's330', 0],\n",
       " ['u395', 's768', 0],\n",
       " ['u395', 's615', 0],\n",
       " ['u396', 's567', 0],\n",
       " ['u396', 's298', 0],\n",
       " ['u396', 's152', 0],\n",
       " ['u397', 's98', 0],\n",
       " ['u397', 's189', 0],\n",
       " ['u397', 's337', 0],\n",
       " ['u397', 's448', 0],\n",
       " ['u398', 's591', 0],\n",
       " ['u398', 's584', 0],\n",
       " ['u399', 's517', 0],\n",
       " ['u404', 's286', 0],\n",
       " ['u404', 's174', 0],\n",
       " ['u407', 's499', 0],\n",
       " ['u407', 's277', 0],\n",
       " ['u407', 's371', 0],\n",
       " ['u410', 's154', 0],\n",
       " ['u410', 's403', 0],\n",
       " ['u411', 's669', 0],\n",
       " ['u412', 's340', 0],\n",
       " ['u412', 's87', 0],\n",
       " ['u413', 's261', 0],\n",
       " ['u414', 's257', 0],\n",
       " ['u415', 's403', 0],\n",
       " ['u415', 's352', 0],\n",
       " ['u415', 's586', 0],\n",
       " ['u418', 's766', 0],\n",
       " ['u418', 's499', 0],\n",
       " ['u419', 's35', 0],\n",
       " ['u419', 's410', 0],\n",
       " ['u419', 's579', 0],\n",
       " ['u421', 's472', 0],\n",
       " ['u422', 's460', 0],\n",
       " ['u422', 's489', 0],\n",
       " ['u424', 's337', 0],\n",
       " ['u425', 's433', 0],\n",
       " ['u428', 's430', 0],\n",
       " ['u428', 's482', 0],\n",
       " ['u428', 's288', 0],\n",
       " ['u428', 's409', 0],\n",
       " ['u428', 's101', 0],\n",
       " ['u430', 's444', 0],\n",
       " ['u430', 's207', 0],\n",
       " ['u430', 's261', 0],\n",
       " ['u432', 's104', 0],\n",
       " ['u432', 's330', 0],\n",
       " ['u433', 's557', 0],\n",
       " ['u433', 's617', 0],\n",
       " ['u434', 's740', 0],\n",
       " ['u434', 's542', 0],\n",
       " ['u436', 's433', 0],\n",
       " ['u437', 's104', 0],\n",
       " ['u438', 's364', 0],\n",
       " ['u439', 's571', 0],\n",
       " ['u440', 's472', 0],\n",
       " ['u441', 's69', 0],\n",
       " ['u441', 's526', 0],\n",
       " ['u441', 's42', 0],\n",
       " ['u441', 's403', 0],\n",
       " ['u441', 's165', 0],\n",
       " ['u441', 's72', 0],\n",
       " ['u442', 's308', 0],\n",
       " ['u442', 's748', 0],\n",
       " ['u443', 's498', 0],\n",
       " ['u444', 's143', 0],\n",
       " ['u445', 's338', 0],\n",
       " ['u446', 's407', 0],\n",
       " ['u446', 's235', 0],\n",
       " ['u446', 's351', 0],\n",
       " ['u446', 's123', 0],\n",
       " ['u447', 's346', 0],\n",
       " ['u447', 's481', 0],\n",
       " ['u447', 's307', 0],\n",
       " ['u447', 's230', 0],\n",
       " ['u447', 's690', 0],\n",
       " ['u447', 's362', 0],\n",
       " ['u448', 's90', 0],\n",
       " ['u448', 's781', 0],\n",
       " ['u448', 's671', 0],\n",
       " ['u449', 's273', 0],\n",
       " ['u450', 's333', 0],\n",
       " ['u455', 's576', 0],\n",
       " ['u455', 's101', 0],\n",
       " ['u455', 's14', 0],\n",
       " ['u456', 's234', 0],\n",
       " ['u458', 's69', 0],\n",
       " ['u458', 's453', 0],\n",
       " ['u462', 's776', 0],\n",
       " ['u462', 's440', 0],\n",
       " ['u465', 's653', 0],\n",
       " ['u465', 's245', 0],\n",
       " ['u467', 's305', 0],\n",
       " ['u468', 's337', 0],\n",
       " ['u468', 's627', 0],\n",
       " ['u469', 's719', 0],\n",
       " ['u471', 's212', 0],\n",
       " ['u472', 's634', 0],\n",
       " ['u473', 's354', 0],\n",
       " ['u473', 's140', 0],\n",
       " ['u475', 's18', 0],\n",
       " ['u475', 's123', 0],\n",
       " ['u476', 's257', 0],\n",
       " ['u476', 's494', 0],\n",
       " ['u476', 's410', 0],\n",
       " ['u477', 's763', 0],\n",
       " ['u477', 's647', 0],\n",
       " ['u477', 's82', 0],\n",
       " ['u480', 's772', 0],\n",
       " ['u480', 's708', 0],\n",
       " ['u481', 's364', 0],\n",
       " ['u481', 's754', 0],\n",
       " ['u481', 's146', 0],\n",
       " ['u482', 's574', 0],\n",
       " ['u482', 's598', 0],\n",
       " ['u483', 's253', 0],\n",
       " ['u483', 's601', 0],\n",
       " ['u484', 's389', 0],\n",
       " ['u484', 's562', 0],\n",
       " ['u485', 's265', 0],\n",
       " ['u488', 's433', 0],\n",
       " ['u489', 's548', 0],\n",
       " ['u489', 's586', 0],\n",
       " ['u490', 's330', 0],\n",
       " ['u490', 's531', 0],\n",
       " ['u490', 's441', 0],\n",
       " ['u490', 's150', 0],\n",
       " ['u493', 's499', 0],\n",
       " ['u493', 's605', 0],\n",
       " ['u494', 's450', 0],\n",
       " ['u494', 's267', 0],\n",
       " ['u498', 's407', 0],\n",
       " ['u498', 's349', 0],\n",
       " ['u499', 's405', 0],\n",
       " ['u499', 's468', 0],\n",
       " ['u500', 's725', 0],\n",
       " ['u500', 's659', 0],\n",
       " ['u501', 's642', 0],\n",
       " ['u502', 's736', 0],\n",
       " ['u503', 's622', 0],\n",
       " ['u503', 's519', 0],\n",
       " ['u505', 's37', 0],\n",
       " ['u505', 's155', 0],\n",
       " ['u507', 's411', 0],\n",
       " ['u508', 's13', 0],\n",
       " ['u508', 's300', 0],\n",
       " ['u509', 's646', 0],\n",
       " ['u509', 's517', 0],\n",
       " ['u509', 's143', 0],\n",
       " ['u510', 's132', 0],\n",
       " ['u513', 's732', 0],\n",
       " ['u514', 's183', 0],\n",
       " ['u515', 's669', 0],\n",
       " ['u515', 's13', 0],\n",
       " ['u515', 's716', 0],\n",
       " ['u515', 's49', 0],\n",
       " ['u515', 's519', 0],\n",
       " ['u516', 's22', 0],\n",
       " ['u520', 's153', 0],\n",
       " ['u520', 's190', 0],\n",
       " ['u520', 's787', 0],\n",
       " ['u521', 's318', 0],\n",
       " ['u522', 's494', 0],\n",
       " ['u523', 's733', 0],\n",
       " ['u523', 's718', 0],\n",
       " ['u524', 's28', 0],\n",
       " ['u525', 's637', 0],\n",
       " ['u525', 's605', 0],\n",
       " ['u525', 's428', 0],\n",
       " ['u527', 's99', 0],\n",
       " ['u527', 's316', 0],\n",
       " ['u527', 's516', 0],\n",
       " ['u528', 's642', 0],\n",
       " ['u529', 's63', 0],\n",
       " ['u530', 's429', 0],\n",
       " ['u531', 's143', 0],\n",
       " ['u532', 's781', 0],\n",
       " ['u535', 's302', 0],\n",
       " ['u535', 's351', 0],\n",
       " ['u537', 's473', 0],\n",
       " ['u537', 's556', 0],\n",
       " ['u537', 's637', 0],\n",
       " ['u538', 's99', 0],\n",
       " ['u539', 's605', 0],\n",
       " ['u540', 's439', 0],\n",
       " ['u541', 's343', 0],\n",
       " ['u541', 's466', 0],\n",
       " ['u542', 's175', 0],\n",
       " ['u543', 's623', 0],\n",
       " ['u543', 's25', 0],\n",
       " ['u543', 's419', 0],\n",
       " ['u544', 's200', 0],\n",
       " ['u544', 's502', 0],\n",
       " ['u544', 's317', 0],\n",
       " ['u544', 's53', 0],\n",
       " ['u544', 's70', 0],\n",
       " ['u545', 's299', 0],\n",
       " ['u547', 's190', 0],\n",
       " ['u549', 's343', 0],\n",
       " ['u549', 's690', 0],\n",
       " ['u549', 's458', 0],\n",
       " ['u550', 's725', 0],\n",
       " ['u552', 's43', 0],\n",
       " ['u553', 's516', 0],\n",
       " ['u553', 's347', 0],\n",
       " ['u555', 's188', 0],\n",
       " ['u555', 's306', 0],\n",
       " ['u555', 's615', 0],\n",
       " ['u555', 's117', 0],\n",
       " ['u555', 's759', 0],\n",
       " ['u556', 's387', 0],\n",
       " ['u556', 's176', 0],\n",
       " ['u557', 's337', 0],\n",
       " ['u557', 's407', 0],\n",
       " ['u557', 's301', 0],\n",
       " ['u557', 's202', 0],\n",
       " ['u558', 's768', 0],\n",
       " ['u558', 's448', 0],\n",
       " ['u558', 's69', 0],\n",
       " ['u558', 's221', 0],\n",
       " ['u559', 's389', 0],\n",
       " ['u559', 's653', 0],\n",
       " ['u561', 's283', 0],\n",
       " ['u561', 's505', 0],\n",
       " ['u562', 's69', 0],\n",
       " ['u562', 's257', 0],\n",
       " ['u563', 's215', 0],\n",
       " ['u563', 's241', 0],\n",
       " ['u565', 's591', 0],\n",
       " ['u565', 's446', 0],\n",
       " ['u565', 's34', 0],\n",
       " ['u567', 's650', 0],\n",
       " ['u568', 's104', 0],\n",
       " ['u569', 's389', 0],\n",
       " ['u569', 's562', 0],\n",
       " ['u569', 's468', 0],\n",
       " ['u569', 's446', 0],\n",
       " ['u570', 's605', 0],\n",
       " ['u570', 's748', 0],\n",
       " ['u570', 's301', 0],\n",
       " ['u570', 's354', 0],\n",
       " ['u573', 's384', 0],\n",
       " ['u573', 's50', 0],\n",
       " ['u573', 's20', 0],\n",
       " ['u573', 's221', 0],\n",
       " ['u573', 's708', 0],\n",
       " ['u573', 's419', 0],\n",
       " ['u573', 's379', 0],\n",
       " ['u574', 's61', 0],\n",
       " ['u574', 's442', 0],\n",
       " ['u574', 's207', 0],\n",
       " ['u576', 's62', 0],\n",
       " ['u576', 's140', 0],\n",
       " ['u577', 's523', 0],\n",
       " ['u579', 's485', 0],\n",
       " ['u580', 's512', 0],\n",
       " ['u581', 's234', 0],\n",
       " ['u581', 's235', 0],\n",
       " ['u582', 's160', 0],\n",
       " ['u582', 's441', 0],\n",
       " ['u582', 's473', 0],\n",
       " ['u584', 's468', 0],\n",
       " ['u585', 's738', 0],\n",
       " ['u585', 's92', 0],\n",
       " ['u585', 's437', 0],\n",
       " ['u585', 's664', 0],\n",
       " ['u587', 's286', 0],\n",
       " ['u587', 's512', 0],\n",
       " ['u587', 's686', 0],\n",
       " ['u587', 's242', 0],\n",
       " ['u587', 's556', 0],\n",
       " ['u589', 's299', 0],\n",
       " ['u592', 's32', 0],\n",
       " ['u592', 's473', 0],\n",
       " ['u595', 's351', 0],\n",
       " ['u595', 's174', 0],\n",
       " ['u595', 's59', 0],\n",
       " ['u598', 's162', 0],\n",
       " ['u598', 's419', 0],\n",
       " ['u598', 's407', 0],\n",
       " ['u598', 's571', 0],\n",
       " ['u600', 's99', 0],\n",
       " ['u600', 's32', 0],\n",
       " ['u600', 's277', 0],\n",
       " ['u600', 's455', 0],\n",
       " ['u601', 's277', 0],\n",
       " ['u604', 's672', 0],\n",
       " ['u604', 's203', 0],\n",
       " ['u605', 's659', 0],\n",
       " ['u605', 's305', 0],\n",
       " ['u605', 's221', 0],\n",
       " ['u605', 's344', 0],\n",
       " ['u605', 's300', 0],\n",
       " ['u607', 's444', 0],\n",
       " ['u608', 's401', 0],\n",
       " ['u609', 's566', 0],\n",
       " ['u609', 's772', 0],\n",
       " ['u609', 's174', 0],\n",
       " ['u611', 's301', 0],\n",
       " ['u611', 's242', 0],\n",
       " ['u614', 's602', 0],\n",
       " ['u615', 's167', 0],\n",
       " ['u615', 's529', 0],\n",
       " ['u616', 's607', 0],\n",
       " ['u619', 's481', 0],\n",
       " ['u619', 's361', 0],\n",
       " ['u619', 's472', 0],\n",
       " ['u619', 's698', 0],\n",
       " ['u620', 's308', 0],\n",
       " ['u620', 's529', 0],\n",
       " ['u624', 's605', 0],\n",
       " ['u625', 's281', 0],\n",
       " ['u628', 's191', 0],\n",
       " ['u630', 's627', 0],\n",
       " ['u631', 's634', 0],\n",
       " ['u631', 's77', 0],\n",
       " ['u631', 's752', 0],\n",
       " ['u632', 's57', 0],\n",
       " ['u632', 's140', 0],\n",
       " ['u633', 's329', 0],\n",
       " ['u633', 's337', 0],\n",
       " ['u634', 's517', 0],\n",
       " ['u634', 's307', 0],\n",
       " ['u635', 's434', 0],\n",
       " ['u635', 's566', 0],\n",
       " ['u635', 's556', 0],\n",
       " ['u638', 's396', 0],\n",
       " ['u640', 's202', 0],\n",
       " ['u640', 's416', 0],\n",
       " ['u640', 's605', 0],\n",
       " ['u641', 's518', 0],\n",
       " ['u641', 's448', 0],\n",
       " ['u641', 's637', 0],\n",
       " ['u642', 's699', 0],\n",
       " ['u642', 's388', 0],\n",
       " ['u642', 's473', 0],\n",
       " ['u644', 's308', 0],\n",
       " ['u645', 's260', 0],\n",
       " ['u645', 's203', 0],\n",
       " ['u645', 's444', 0],\n",
       " ['u647', 's520', 0],\n",
       " ['u647', 's529', 0],\n",
       " ['u649', 's200', 0],\n",
       " ['u650', 's124', 0],\n",
       " ['u651', 's280', 0],\n",
       " ['u651', 's260', 0],\n",
       " ['u651', 's256', 0],\n",
       " ['u654', 's396', 0],\n",
       " ['u655', 's99', 0],\n",
       " ['u655', 's445', 0],\n",
       " ['u656', 's16', 0],\n",
       " ['u656', 's676', 0],\n",
       " ['u657', 's167', 0],\n",
       " ['u657', 's114', 0],\n",
       " ['u663', 's343', 0],\n",
       " ['u663', 's202', 0],\n",
       " ['u664', 's34', 0],\n",
       " ['u665', 's587', 0],\n",
       " ['u667', 's271', 0],\n",
       " ['u667', 's59', 0],\n",
       " ['u669', 's442', 0],\n",
       " ['u669', 's34', 0],\n",
       " ['u671', 's522', 0],\n",
       " ['u671', 's203', 0],\n",
       " ['u671', 's362', 0],\n",
       " ['u671', 's260', 0],\n",
       " ['u672', 's407', 0],\n",
       " ['u672', 's32', 0],\n",
       " ['u674', 's509', 0],\n",
       " ['u674', 's42', 0],\n",
       " ['u676', 's351', 0],\n",
       " ['u676', 's413', 0],\n",
       " ['u676', 's454', 0],\n",
       " ['u676', 's526', 0],\n",
       " ['u677', 's68', 0],\n",
       " ['u678', 's216', 0],\n",
       " ['u678', 's642', 0],\n",
       " ['u681', 's528', 0],\n",
       " ['u681', 's305', 0],\n",
       " ['u681', 's340', 0],\n",
       " ['u681', 's488', 0],\n",
       " ['u682', 's143', 0],\n",
       " ['u682', 's614', 0],\n",
       " ['u682', 's736', 0],\n",
       " ['u683', 's299', 0],\n",
       " ['u683', 's508', 0],\n",
       " ['u683', 's731', 0],\n",
       " ['u684', 's37', 0],\n",
       " ['u685', 's150', 0],\n",
       " ['u686', 's336', 0],\n",
       " ['u687', 's407', 0],\n",
       " ['u687', 's302', 0],\n",
       " ['u693', 's526', 0],\n",
       " ['u693', 's18', 0],\n",
       " ['u694', 's333', 0],\n",
       " ['u694', 's512', 0],\n",
       " ['u695', 's485', 0],\n",
       " ['u695', 's575', 0],\n",
       " ['u695', 's125', 0],\n",
       " ['u695', 's473', 0],\n",
       " ['u696', 's403', 0],\n",
       " ['u696', 's722', 0],\n",
       " ['u697', 's305', 0],\n",
       " ['u697', 's556', 0],\n",
       " ['u698', 's505', 0],\n",
       " ['u699', 's202', 0],\n",
       " ['u700', 's24', 0],\n",
       " ['u700', 's64', 0],\n",
       " ['u701', 's32', 0],\n",
       " ['u701', 's428', 0],\n",
       " ...]"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list=[]\n",
    "for uid,sid in test_neg_candidates:\n",
    "    list.append(['u'+str(uid),'s'+str(sid),0])\n",
    "list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "9d8a3ee9",
   "metadata": {},
   "outputs": [],
   "source": [
    "test=pd.DataFrame(data=list)\n",
    "test.to_csv('dd_label.csv',encoding='gbk')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1ca2c14f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "common",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.11"
  },
  "vscode": {
   "interpreter": {
    "hash": "667cee6c259ca2b2ea592a6fdd7f060f564df2e643d223b05bb866e6548d5c75"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
